import React, { Component, Fragment } from 'react'
import LoadingComponent from '../components/Loading/loading.js'
import { connect } from 'react-redux'
class Loading extends Component {
  constructor(props) {
    super(props)
    this.state = {}
  }
  render() {
    const wrap = {
      width: '100vw',
      height: '100vh',
      position: 'fixed',
      top: '0px',
      bottom: '0px',
      background: 'rgba(0,0,0,0.7)',
    }

    return (
      <Fragment>
        <div style={wrap}>
          <LoadingComponent
            loadingFlag={this.props.loadingFlag}
          ></LoadingComponent>
        </div>
      </Fragment>
    )
  }
}

const mapStateToProps = (state) => {
  return {
    loadingFlag: state.loadingFlag,
  }
}
const mapDispatchToProps = (dispatch) => {
  return {}
}
//最后利用store挂钩

export default connect(
  mapStateToProps, //这里面放的是数据
  mapDispatchToProps //里面放的是操作的数据的方法
)(Loading)
